<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>OSI模型中的网络协议层次解析</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            position: relative;
            overflow: hidden;
        }
        
        .hero-gradient::before {
            content: '';
            position: absolute;
            top: -50%;
            right: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
            animation: pulse 4s ease-in-out infinite;
        }
        
        @keyframes pulse {
            0%, 100% { transform: scale(1); opacity: 0.5; }
            50% { transform: scale(1.1); opacity: 0.3; }
        }
        
        .protocol-card {
            background: white;
            border-radius: 20px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }
        
        .protocol-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 5px;
            background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
        }
        
        .protocol-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.15);
        }
        
        .layer-badge {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 0.5rem 1.5rem;
            border-radius: 50px;
            font-weight: 600;
            display: inline-block;
            margin-bottom: 1rem;
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
        }
        
        .icon-wrapper {
            width: 80px;
            height: 80px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 2rem;
            margin-bottom: 1.5rem;
            box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
        }
        
        .content-section {
            background: white;
            border-radius: 20px;
            padding: 3rem;
            margin: 2rem 0;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
        }
        
        .drop-cap {
            float: left;
            font-size: 4rem;
            line-height: 1;
            font-weight: 700;
            margin-right: 0.5rem;
            color: #667eea;
            font-family: 'Noto Serif SC', serif;
        }
        
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 3rem 0;
        }
        
        h1, h2, h3 {
            font-family: 'Noto Serif SC', serif;
        }
        
        .analogy-box {
            background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
            border-left: 4px solid #667eea;
            padding: 1.5rem;
            margin: 1.5rem 0;
            border-radius: 10px;
            position: relative;
        }
        
        .analogy-box::before {
            content: '\f0eb';
            font-family: 'Font Awesome 6 Free';
            font-weight: 900;
            position: absolute;
            top: 1.5rem;
            left: -2rem;
            background: #667eea;
            color: white;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <div class="hero-gradient text-white py-20 px-8">
        <div class="max-w-6xl mx-auto text-center relative z-10">
            <h1 class="text-5xl md:text-6xl font-bold mb-6 leading-tight">
                OSI模型中的网络协议层次
            </h1>
            <p class="text-xl md:text-2xl opacity-90 max-w-3xl mx-auto">
                深入理解TCP、HTTP和FTP在网络通信架构中的定位与作用
            </p>
        </div>
    </div>

    <!-- Main Content -->
    <div class="max-w-6xl mx-auto px-8 py-12">
        <!-- Introduction -->
        <div class="content-section">
            <p class="text-lg leading-relaxed text-gray-700">
                <span class="drop-cap">在</span>OSI（开放系统互连）模型中，TCP、HTTP和FTP分别位于不同的层，每一层负责不同类型的网络通信功能。理解这些协议在OSI模型中的位置，对于深入掌握网络通信原理至关重要。
            </p>
        </div>

        <!-- OSI Model Visualization -->
        <div class="content-section">
            <h2 class="text-3xl font-bold text-gray-800 mb-6 text-center">OSI七层模型架构图</h2>
            <div class="mermaid">
                graph TD
                    A[应用层 - Layer 7<br/>HTTP, FTP, SMTP] --> B[表示层 - Layer 6<br/>数据格式转换]
                    B --> C[会话层 - Layer 5<br/>会话管理]
                    C --> D[传输层 - Layer 4<br/>TCP, UDP]
                    D --> E[网络层 - Layer 3<br/>IP, ICMP]
                    E --> F[数据链路层 - Layer 2<br/>以太网, WiFi]
                    F --> G[物理层 - Layer 1<br/>电缆, 光纤]
                    
                    style A fill:#667eea,stroke:#fff,stroke-width:3px,color:#fff
                    style D fill:#764ba2,stroke:#fff,stroke-width:3px,color:#fff
            </div>
        </div>

        <!-- Protocol Cards -->
        <div class="grid md:grid-cols-3 gap-8 my-12">
            <!-- TCP Card -->
            <div class="protocol-card p-8">
                <div class="icon-wrapper">
                    <i class="fas fa-network-wired"></i>
                </div>
                <span class="layer-badge">传输层</span>
                <h3 class="text-2xl font-bold text-gray-800 mb-4">TCP 传输控制协议</h3>
                <p class="text-gray-600 leading-relaxed mb-4">
                    位于OSI模型第四层，负责提供可靠的端到端数据传输服务。通过分段、流量控制、拥塞控制和错误检测等机制，确保数据的完整性和顺序性。
                </p>
                <div class="analogy-box">
                    <p class="text-gray-700">
                        <strong>类比：</strong>如同一个负责快递包裹的可靠物流公司，不仅将包裹安全送达，还确保所有包裹按顺序到达。
                    </p>
                </div>
            </div>

            <!-- HTTP Card -->
            <div class="protocol-card p-8">
                <div class="icon-wrapper">
                    <i class="fas fa-globe"></i>
                </div>
                <span class="layer-badge">应用层</span>
                <h3 class="text-2xl font-bold text-gray-800 mb-4">HTTP 超文本传输协议</h3>
                <p class="text-gray-600 leading-relaxed mb-4">
                    位于OSI模型第七层，是万维网数据交换的基础。定义了客户端和服务器之间的请求响应模式，采用无状态设计，每次请求独立处理。
                </p>
                <div class="analogy-box">
                    <p class="text-gray-700">
                        <strong>类比：</strong>像餐厅服务员，只负责传递菜单和订单，不会记住客户之前的点单内容。
                    </p>
                </div>
            </div>

            <!-- FTP Card -->
            <div class="protocol-card p-8">
                <div class="icon-wrapper">
                    <i class="fas fa-folder-open"></i>
                </div>
                <span class="layer-badge">应用层</span>
                <h3 class="text-2xl font-bold text-gray-800 mb-4">FTP 文件传输协议</h3>
                <p class="text-gray-600 leading-relaxed mb-4">
                    同样位于OSI模型第七层，专门用于客户端和服务器之间的文件传输。支持双向传输、用户认证和访问控制功能。
                </p>
                <div class="analogy-box">
                    <p class="text-gray-700">
                        <strong>类比：</strong>类似专门的邮递员服务，能够发送接收包裹，并允许定制传递时间和顺序。
                    </p>
                </div>
            </div>
        </div>

        <!-- Key Concepts -->
        <div class="content-section">
            <h2 class="text-3xl font-bold text-gray-800 mb-8 text-center">
                <i class="fas fa-key text-purple-600 mr-3"></i>核心概念解析
            </h2>
            <div class="grid md:grid-cols-2 gap-6">
                <div class="bg-gradient-to-br from-purple-50 to-indigo-50 p-6 rounded-xl">
                    <h4 class="text-xl font-semibold text-gray-800 mb-3">
                        <i class="fas fa-layer-group text-purple-600 mr-2"></i>层次化设计
                    </h4>
                    <p class="text-gray-700">
                        OSI模型采用分层架构，每一层都有明确的职责和功能。上层协议依赖下层提供的服务，形成完整的通信体系。
                    </p>
                </div>
                <div class="bg-gradient-to-br from-purple-50 to-indigo-50 p-6 rounded-xl">
                    <h4 class="text-xl font-semibold text-gray-800 mb-3">
                        <i class="fas fa-exchange-alt text-purple-600 mr-2"></i>协议交互
                    </h4>
                    <p class="text-gray-700">
                        HTTP和FTP等应用层协议通常使用TCP作为传输层协议，利用TCP的可靠传输特性确保数据完整性。
                    </p>
                </div>
                <div class="bg-gradient-to-br from-purple-50 to-indigo-50 p-6 rounded-xl">
                    <h4 class="text-xl font-semibold text-gray-800 mb-3">
                        <i class="fas fa-shield-alt text-purple-600 mr-2"></i>可靠性保证
                    </h4>
                    <p class="text-gray-700">
                        TCP通过序列号、确认机制、重传等技术手段，为上层应用提供可靠的数据传输服务。
                    </p>
                </div>
                <div class="bg-gradient-to-br from-purple-50 to-indigo-50 p-6 rounded-xl">
                    <h4 class="text-xl font-semibold text-gray-800 mb-3">
                        <i class="fas fa-cogs text-purple-600 mr-2"></i>功能分离
                    </h4>
                    <p class="text-gray-700">
                        每个协议专注于特定功能：TCP负责传输，HTTP负责Web通信，FTP负责文件传输，实现关注点分离。
                    </p>
                </div>
            </div>
        </div>

        <!-- Summary -->
        <div class="bg-gradient-to-r from-purple-600 to-indigo-600 text-white p-8 rounded-2xl mt-12">
            <h2 class="text-3xl font-bold mb-4">总结</h2>
            <p class="text-lg leading-relaxed">
                理解TCP、HTTP和FTP在OSI模型中的位置，有助于我们更好地设计和优化网络应用。TCP作为传输层协议，为应用层的HTTP和FTP提供了可靠的数据传输基础。而HTTP和FTP作为应用层协议，直接服务于用户的具体需求，分别处理Web内容传输和文件传输任务。这种分层设计使得网络协议栈更加模块化、可维护和可扩展。
            </p>
        </div>
    </div>

    <script>
        mermaid.initialize({ 
            startOnLoad: true,
            theme: 'default',
            theme